//Jay A Patel
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define Fast ios::sync_with_stdio(0); cin.tie(0);
#define fr(a, b, c) for(int(a) = (b); (a) < (c); ++(a))
#define fre(a, b) for (auto&(a) : (b))
#define pi 3.1415926536
#define tc ll t; cin>>t; while(t--)
const ll template_array_size = 1e6 + 4265;
int a[template_array_size];
int cnt[template_array_size];
int b[template_array_size];
int n,m,h,k,mn=15000009,target,x,y,p;
const int MX = 2e5+10;
priority_queue<pair<int,int>> q;
#define diff 1e-6
int main(){
cin>>n>>p;
fr(i,1,n+1) cin>>a[i]>>b[i];
double l=0,r=1e12;
while(r-l>diff) {
double mid = (l+r)/2,need=0;
fr(i,1,n+1) {
if(b[i]>=a[i]*mid) continue;
need+=a[i]*mid-b[i];
}
if(need<=p*mid)l=mid;
else r=mid;
}
if(l>9e11)cout<<"-1"<<'\n';
else cout<<l<<'\n';
}
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |